﻿using System.Reflection;
using NLite.Internal;

namespace NLite.Reflection
{
    delegate object ConstructorHandler(params object[] arguments);

    /// <summary>
    /// 
    /// </summary>
    public static class CounstructorExtensions
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="constructor"></param>
        /// <param name="args"></param>
        /// <returns></returns>
        public static object FastInvoke(this ConstructorInfo constructor, params object[] args)
        {
            if (args == null) args = new object[0];

            return DynamicMethodFactoryProxy.Instance.CreateConstructorMethod(constructor)(args);
        }
    }

}
